<?php
/**
 * Created by PhpStorm.
 * User: lili
 * Date: 2018/11/16
 * Time: 17:24
 */

namespace app\index\validate;


use think\Validate;

class User extends Validate
{
    protected $rule = [
        'username' => 'require',
        'sex' => 'require|in:1,2',
        'age' => 'require|number|between:1,120',
        'height' => 'require',
        'weight' => 'require'
    ];

    protected $message  =   [
        'username.require' => '用户名称必须',
        'sex.require' => '性别必须',
        'sex.in' => '性别必须是1或者2,1是男，2是女',
        'age.require' => '年龄必须',
        'height.require' => '身高必须',
        'weight.require' => '体重必须',
        'age.number'   => '年龄必须是数字',
        'age.between'  => '年龄只能在1-120之间'
    ];

    protected $scene = [
        'modify'  =>  ['username,age,height,weight'],
    ];

}